#include<stdio.h>

int main(){
	char buffer[100] = {0};
	int year = 2024;
	int month = 10;
	int day = 1;

	//往字符串写入数据
	sprintf(buffer, "%d-%d-%d", year, month, day);
	printf("%s\n", buffer);

	//从字符串里读出数据
	int syear;
	int smonth;
	int sday;
	
	sscanf(buffer, "%d-%d-%d", &syear, &smonth, &sday);
	printf("%d-%d-%d\n", syear, smonth, sday);

}
